package org.langqiao.thread;

public class DrawThread extends Thread{

	private Account account;
	
	private double drawAmount;//取钱金额
	
	public DrawThread(String name ,Account account,double drawAmount){
		super(name);
		this.account = account;
		this.drawAmount = drawAmount;
	}
	
	public void run(){
		account.draw(drawAmount);
		/*synchronized (account) {
			if(account.getBalance() >= drawAmount){
				System.out.println(getName() +",取钱成功，吐出钞票：" + drawAmount);
				try{
					Thread.sleep(1);
				}catch(Exception e){
					
				}
				account.setBalance(account.getBalance()-drawAmount);
				System.out.println("取款后，所剩余额为："+account.getBalance());
			}else{
				System.out.println("你的余额不足,取款失败！");
			}
		}*/
	}

}
